import React, { useState } from "react";

const Number = (props) => {
  const [count, setCount] = useState(0);
  
  const { getChild }  =props;


  return (
    <div>
      <span>{props.name}</span>
      <button onClick={() => setCount(count + 1)}>+</button>
      <span>{count}</span>
      <button onClick={() => setCount((count) => count - 1)}>-</button>
        <br/>
      <button onClick={() => getChild('嗯  我是子组件')}>给父组件传值</button>
      
    </div>
  );
};

export default Number;
